package com.ruoyi.project.data.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.data.mapper.WaybillAlarmInformationMapper;
import com.ruoyi.project.data.domain.WaybillAlarmInformation;
import com.ruoyi.project.data.service.IWaybillAlarmInformationService;

/**
 * 运单报警信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-04-27
 */
@Service
public class WaybillAlarmInformationServiceImpl implements IWaybillAlarmInformationService 
{
    @Autowired
    private WaybillAlarmInformationMapper waybillAlarmInformationMapper;

    /**
     * 查询运单报警信息
     * 
     * @param id 运单报警信息ID
     * @return 运单报警信息
     */
    @Override
    public WaybillAlarmInformation selectWaybillAlarmInformationById(Long id)
    {
        return waybillAlarmInformationMapper.selectWaybillAlarmInformationById(id);
    }

    /**
     * 查询运单报警信息列表
     * 
     * @param waybillAlarmInformation 运单报警信息
     * @return 运单报警信息
     */
    @Override
    public List<WaybillAlarmInformation> selectWaybillAlarmInformationList(WaybillAlarmInformation waybillAlarmInformation)
    {
        return waybillAlarmInformationMapper.selectWaybillAlarmInformationList(waybillAlarmInformation);
    }

    /**
     * 新增运单报警信息
     * 
     * @param waybillAlarmInformation 运单报警信息
     * @return 结果
     */
    @Override
    public int insertWaybillAlarmInformation(WaybillAlarmInformation waybillAlarmInformation)
    {
        waybillAlarmInformation.setCreateTime(DateUtils.getNowDate());
        return waybillAlarmInformationMapper.insertWaybillAlarmInformation(waybillAlarmInformation);
    }

    /**
     * 修改运单报警信息
     * 
     * @param waybillAlarmInformation 运单报警信息
     * @return 结果
     */
    @Override
    public int updateWaybillAlarmInformation(WaybillAlarmInformation waybillAlarmInformation)
    {
        waybillAlarmInformation.setUpdateTime(DateUtils.getNowDate());
        waybillAlarmInformation.setHandlingPerson(SecurityUtils.getLoginUser().getUser().getNickName());
        waybillAlarmInformation.setHandlingTime(new Date());
        waybillAlarmInformation.setCreateId(String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
        return waybillAlarmInformationMapper.updateWaybillAlarmInformation(waybillAlarmInformation);
    }

    /**
     * 批量删除运单报警信息
     * 
     * @param ids 需要删除的运单报警信息ID
     * @return 结果
     */
    @Override
    public int deleteWaybillAlarmInformationByIds(Long[] ids)
    {
        return waybillAlarmInformationMapper.deleteWaybillAlarmInformationByIds(ids);
    }

    /**
     * 删除运单报警信息信息
     * 
     * @param id 运单报警信息ID
     * @return 结果
     */
    @Override
    public int deleteWaybillAlarmInformationById(Long id)
    {
        return waybillAlarmInformationMapper.deleteWaybillAlarmInformationById(id);
    }
}
